//package com.dh.project.controller;
//
//import com.dh.project.model.Location;
//import com.dh.project.model.common.Response;
//import com.dh.project.other.BaseController;
//import com.dh.project.service.ILocationService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import java.util.Date;
//
///**
// * Author: D.Yang
// * Email: koyangslash@gmail.com
// * Date: 16/10/9
// * Time: 上午11:58
// * Describe: 用户控制器
// */
//@Controller
//public class LocationController extends BaseController {
//
//    private final ILocationService mLocationService;
//
//    @Autowired
//    public LocationController(ILocationService service) {
//        mLocationService = service;
//    }
//
//    @ResponseBody
//    @RequestMapping("/")
//    public Object welcome() {
//        return new Response("启动成功");
//    }
//
//
//    @RequestMapping(value = "/getMap", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")
//    public String map(Model model) {
//
////        List<String> list = new ArrayList<>();
////        list.add("13228898364");
////        PushUtil.pushOne(list, "请求位置");
//
////        List<Location> map = mLocationService.selectList(null);
////        LogUtil.i("map: "+map.toString());
////        model.addAttribute("createtime", DateUtil.parseDateToString(map.get(map.size()-1).getCreatetime(), DateUtil.PATTERN_yyyy_MM_dd_HHmmss));
////        model.addAttribute("map", map.get(map.size()-1));
//        return "map";
//    }
//
//    @ResponseBody
//    @RequestMapping(value = "/setLocation")
//    public Response map(@RequestParam String lng, @RequestParam String lat) {
//
//        Location location = new Location();
//        location.setLat(lat);
//        location.setLng(lng);
//        location.setCreatetime(new Date());
//
//        boolean isSuccess = mLocationService.insert(location);
//
//        Response res = new Response();
//        if (!isSuccess) {
//            res.setStatus(Response.Status.ERROR);
//            res.setInfo("操作失败");
//        }
//        res.setData(new Object());
//
//        return res;
//    }
//
////    @ResponseBody
////    @RequestMapping(value = "/protostuff")
////    public Object proto() {
////        List<PushAll> list = new ArrayList<>();
////        int x = 0;
////        while (x < 1000) {
////            PushAll all1 = new PushAll("通知" + x, "消息" + x, 1);
////            list.add(all1);
////            x++;
////        }
////        ListPush listPush = new ListPush();
////        listPush.setList(list);
////        return listPush;
//////        String res = "";
//////        try {
//////            res = new String(ProtostuffIOUtil.toByteArray(listPush, schema, LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BUFFER_SIZE)), "utf-8");
//////        } catch (UnsupportedEncodingException e) {
//////            e.printStackTrace();
//////        }
//////
//////        return res;
////    }
////
////    private RuntimeSchema<ListPush> schema = RuntimeSchema.createFrom(ListPush.class);
//
//}
